import java.sql.connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQlException;
import java.sql.Statement;
public class DbManager{
static final String jDBC_DRIVER = "com.mysql.jdbc.driver";
static final String DB_URL = "jdbc:mysql://localhost/EMP;
static final String USER = "user name";
static final String PASSWORD = "password";
public ResultSet retrivData(){
connection conn = null;
Statement stmt = null;
ResultSet = null; 
try
{
Class.forName("com.mysql.jdbc.driver");
conn = DriverManager.getConnection(DB_URL,USER,PASS);
stmt = conn.createStatement();
String sql;
sql = "SELECT id,first,last,last age from Employees";
rs = stmt.executeQuery(sql);
return rs;
}
catch(SQLException se)
{
se.printstackTrace();
}
catch(Exception e)
{
e.printstackTrace();
}
finally{
try{
if(conn !=null)
conn.close();
if(stmt !=null)
stmt.close();
}catch(SQLException se)
{
se.printStackTrace();
}
}
return rs;
}
}